package o;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import androidx.annotation.Nullable;
import java.util.Arrays;

@TargetApi(21)
public final class abz {
    public static final abz ˎ = new abz(new int[]{2}, 8);
    private final int[] ˏ;
    private final int ॱ;

    public static abz ˏ(Context context) {
        return ˊ(context.registerReceiver(null, new IntentFilter("android.media.action.HDMI_AUDIO_PLUG")));
    }

    @SuppressLint({"InlinedApi"})
    static abz ˊ(@Nullable Intent intent) {
        if (intent == null || intent.getIntExtra("android.media.extra.AUDIO_PLUG_STATE", 0) == 0) {
            return ˎ;
        }
        return new abz(intent.getIntArrayExtra("android.media.extra.ENCODINGS"), intent.getIntExtra("android.media.extra.MAX_CHANNEL_COUNT", 8));
    }

    public abz(@Nullable int[] iArr, int i) {
        if (iArr != null) {
            this.ˏ = Arrays.copyOf(iArr, iArr.length);
            Arrays.sort(this.ˏ);
        } else {
            this.ˏ = new int[0];
        }
        this.ॱ = i;
    }

    public boolean ˋ(int i) {
        return Arrays.binarySearch(this.ˏ, i) >= 0;
    }

    public int ˏ() {
        return this.ॱ;
    }

    public boolean equals(@Nullable Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof abz)) {
            return false;
        }
        abz o_abz = (abz) obj;
        if (Arrays.equals(this.ˏ, o_abz.ˏ) && this.ॱ == o_abz.ॱ) {
            return true;
        }
        return false;
    }

    public int hashCode() {
        return this.ॱ + (Arrays.hashCode(this.ˏ) * 31);
    }

    public String toString() {
        return "AudioCapabilities[maxChannelCount=" + this.ॱ + ", supportedEncodings=" + Arrays.toString(this.ˏ) + "]";
    }
}
